package com.example.demo.service.impl;

import com.example.demo.entity.SheZhi;
import com.example.demo.mapper.SheZhiMapper;
import com.example.demo.service.SheZhiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Service
public class ShiZhiServiceImpl implements SheZhiService {

    @Autowired
    SheZhiMapper sheZhiMapper;

    @PostMapping("/sheZhi")
    public int save(@RequestBody SheZhi sheZhi){
        return sheZhiMapper.save(sheZhi);
    }

    @DeleteMapping("/sheZhi/{tsId}")
    public int delete(@PathVariable("tsId") int tsId){
        return sheZhiMapper.delete(tsId);
    }

    @PutMapping("/sheZhi")
    public int update(@RequestBody SheZhi sheZhi){
        return sheZhiMapper.update(sheZhi);
    }

    @GetMapping("/sheZhi")
    public List<SheZhi> select(){
        return sheZhiMapper.select();
    }
}

